package mysql

import "gorm.io/gorm"

type BuyCar struct {
	gorm.Model
	UserId  int     `gorm:"type:int;comment:用户id"`
	ClassId int     `gorm:"type:int;comment:课程商品id"`
	Name    string  `gorm:"type:varchar(20);comment:课程名称"`
	Price   float64 `gorm:"type:decimal(10,2);comment:课程价格"`
	Num     int     `gorm:"type:int;comment:数量"`
}

func (BuyCar) TableName() string {
	return "buy_car"
}

func (c *BuyCar) Add() error {
	return DB.Create(&c).Error
}
